/*
 * Copyright (C) 2018 The Asiainfo-Ability Authors
 *
 *      Licensed under the Apache License, Version 2.0 (the "License");
 *      you may not use this file except in compliance with the License.
 *      You may obtain a copy of the License at
 *
 *          http://www.apache.org/licenses/LICENSE-2.0
 *
 *      Unless required by applicable law or agreed to in writing, software
 *      distributed under the License is distributed on an "AS IS" BASIS,
 *      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *      See the License for the specific language governing permissions and
 *      limitations under the License.
 */

package org.asiainfo.ability.provider.impl;


import org.asiainfo.ability.provider.Context;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.Map;

/**
 * @Author: visen
 * @Date: 2018/1/18
 * @Description:
 */    
public class CommonAbilityContext implements Context {

    private HttpServletRequest request;
    private HttpServletResponse response;
    private boolean isError;
    private Object input;
    private String orignInput;
    private Map datas;

    @Override
    public HttpServletRequest getRequest() {
        return this.request;
    }

    @Override
    public HttpServletResponse getResponse() {
        return this.response;
    }

    @Override
    public Object getData(String name) {
        return datas.get(name);
    }

    @Override
    public void setData(String name, Object value) {
        datas.put(name, value);
    }

    @Override
    public Object getInput() {
        return this.input;
    }

    @Override
    public String getOrginInput() {
        return this.orignInput;
    }

    public void setInput(Object input) {
        this.input = input;
    }

    public void setOrignInput(String orignInput) {
        this.orignInput = orignInput;
    }

    public CommonAbilityContext(HttpServletRequest request, HttpServletResponse response) {
        this.request = request;
        this.response = response;
        datas = new HashMap();
    }
}
